'use strict';
const db = uniCloud.database()
exports.main = async (event, context) => {
	//event为客户端上传的参数
	console.log('event : ', event)
	let status=2
	const collection = db.collection('User')
	let res = await collection.add(event)
	// const res = await collection.get()
	// let users=res.data
	// for(let i=0;i<users.length;i++){
	// 	if(users[i].user_name==event.user_name){
	// 		status=-1
	// 		break
	// 	}
	// }
	// if(status==2){
	// 	let res = await collection.add(event)
	// }
	
	//返回数据给客户端
	return {
		"status":status
	}
};
